/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tree;

/**
 *
 * @author adam
 */
public class WriteFileTree extends WriteTree {
    
    private VyrazTree where;
    
    public WriteFileTree(Position start, Position end,VyrazTree where, VyrazTree expression) {
        super(start, end,expression);
        this.where=where;
        
        
    }
    
    @Override
    public void generate(Context ctx){
        VyrazTree expression=super.getExpression();
        
        where.generate(ctx);
         if(expression.getType()!=Type.STRING){
            expression.setType(Type.CONV);
        }
        expression.generate(ctx);
        if(super.isLine()){
           ctx.println("writeln 1"); 
        }else{
            ctx.println("write 1");
        }
        
    }
}
